#include <iostream>
#include "dogservice_api.h"
#include "loghelper.h"

using namespace RockLog;

static void updateExpireDateStatusCallBack(int status)
{
    LOG(kDebug) << "The superdog expire date status: " << status << std::endl;
    if (status != 0)
    {
        LOG(kErr) << "The superdog have arrived expire date! Status: " << status << std::endl;
    }
}

static void updateSessionStatusCallBack(int status)
{
    LOG(kDebug) << "dog status: " << status << std::endl;
    if (status != 0)
    {
        LOG(kErr) << "dog status error! status: " << status << std::endl;
    }
}

int main(int argc, char *argv[])
{
    setDogTimerInterval(3, 30);
    dogStart();
    checkDogExpireDate(updateExpireDateStatusCallBack);
    checkDogStatus(updateSessionStatusCallBack);
    char buf[1024] = { 0 };
    if (0 == getDogMemoryInfo(buf, 1024))
        LOG(kDebug) << "dogMemoryInfo: " << buf << std::endl;
    LOG(kDebug) << "dogExpireDateStatus: " << dogExpireDateStatus() << std::endl;
    LOG(kDebug) << "dogCheckExpDateFlag: " << dogCheckExpDateFlag() << std::endl;
    LOG(kDebug) << "dogStatus: " << dogStatus() << std::endl;

    getchar();
    dogStop();
    return 0;
}
